package ch.zbw.pra.sysventory.utils;

import java.io.Serializable;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Lädt unsere Native Library von Jacob. Mit dieser kann die WMI Schnittstelle abgefragt werden.
 * 
 * @author Roberto Lucas & Ralph Koster
 */

public class FileLoader implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4393360647942627807L;
	private static Logger LOG = LoggerFactory.getLogger(FileLoader.class);
	private static final String JACOB_DLL_LOCATION = "C:/Temp/";
	private static final String FILE_NAME_X64 = "jacob-1.14.3-x64.dll";
	private static final String FILE_NAME_X86 = "jacob-1.14.3-x86.dll";

	public static void loadDllLibrary() {
		try {
			System.loadLibrary(JACOB_DLL_LOCATION + FILE_NAME_X64);
			System.loadLibrary(JACOB_DLL_LOCATION + FILE_NAME_X86);
		} catch (UnsatisfiedLinkError e) {
			LOG.debug("Native code library failed to load: " + e);
		}
	}
}
